package cn.ffcs.businessrequest.dao;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;

import org.apache.commons.lang.StringUtils;
import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
import org.springframework.orm.hibernate3.HibernateCallback;

import cn.ffcs.base.dao.BaseDAO;
import cn.ffcs.base.model.BaseEntity;
import cn.ffcs.businessrequest.model.BusinessRequest;
import cn.ffcs.businessrequest.model.ReqDocu;
import cn.ffcs.common.model.Attach;

/**
 * 
 * 业务需求交互单DAO实现<br/> <table>
 * <tr>
 * <td>负责人/principal: </td>
 * <td colspan="2">pany</td>
 * <tr>
 * <td>修改记录/revision:</td>
 * <td colspan="2"></td>
 * </tr>
 * <tr>
 * <td>日期:</td>
 * <td>修改人:</td>
 * <td>修改说明:</td>
 * </tr>
 * <tr>
 * <td></td>
 * <td></td>
 * <td></td>
 * </tr>
 * </table>
 * @author pany
 * @version $Id$
 */
public class ReqDocuDAO<D extends ReqDocu> extends BaseDAO<D> implements IReqDocuDAO<D>
{

    /**
     * 获取实体类
     * @param b
     * @return
     */
    public String getEntityName()
    {
        return new ReqDocu().getClass().getName();
    }

    /**
     * 获取
     * @param b
     * @return
     */
    public D find(ReqDocu reqDocu)
    {
        String hql = " select a from ReqDocu a where a.refEntityId='"
                + reqDocu.getRefEntityId() + "' a.processDetail='"+reqDocu.getProcessDetail()+"'"+"";
        getSession().createQuery(hql).list();
        return null;
    }
    
    @SuppressWarnings("unchecked")
	public List<ReqDocu> findByEntity(BaseEntity baseEntity){
    	List<ReqDocu> list=new ArrayList<ReqDocu>();
    	String hql=" from ReqDocu a where a.refEntity='"+baseEntity.getClass().getName()+"' AND a.end>sysdate AND a.refEntityId="+baseEntity.getId();
		list=getHibernateTemplate().find(hql);
    	return list;
    }
}
